import axios from "axios";
import service from "@/config/index";

const URLS = {
  SEARCH: `${service.serviceBasic}/customer/search`,
  INSERT: `${service.serviceBasic}/customer`
};

export default {
  search (filter) {
    return axios.post(URLS.SEARCH, filter);
  },
  insert (filter) {
    return axios.post(URLS.INSERT, filter);
  },
  insertShould (filter) {
    return axios.post(`${service.serviceBasic}/customer/should`, filter);
  },
  carrierName (params) {
    return axios.post(`${service.serviceBasic}/carrier/search`, params);
  },
  // 对线上发货方开启委托对账
  openAutoBalance (filter) {
    return axios.put(`${service.serviceBasic}/customer/online/balance/auto/enable`, filter);
  },
  // 对线上发货方关闭委托对账
  closeAutoBalance (filter) {
    return axios.put(`${service.serviceBasic}/customer/online/balance/auto/disable`, filter);
  },
  getCustomerById (customerId) {
    return axios.get(`${service.serviceBasic}/customer/${customerId}`);
  }
};
